import java.util.Arrays;
import java.util.Comparator;

public class Test {
    public static void main(String[] args) {
        Student s1 = new Student("张三", 18, 90.0);
        Student s2 = new Student("李四", 19, 80.0);
        Student s3 = new Student("王五", 20, 70.0);
        Student s4 = new Student("赵六", 21, 60.0);
        Student s5 = new Student("孙七", 22, 50.0);
        Student[] ss = {s1, s2, s3, s4, s5};
        Arrays.sort(ss, new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return (int) (o1.getHeight() - o2.getHeight());
            }
        });

        // 遍历数组中的每个 Student 对象并分别打印
        for (int i = 0; i < ss.length; i++) {
            System.out.println(ss[i]);
        }
    }
}